<style type="text/css">

</style>
<template>
	<div class="mainHight" style="background: url(../../static/img/demo-1-bg.jpg) center center;background-size: 100% 100%;">
		<div id="large-header" class="large-header"> <canvas id="demo-canvas"></canvas>
			<div class="box">
				<h3>Admin</h3> <input type="number" placeholder="请输入您的ID:" id="userId" v-model="userId" /> <input type="password" placeholder="请输入密码:" id="passwold" v-model="passwold" />
				<div style="text-align: left;">
					<el-checkbox v-model="checked" style="width: 100px;height: 20px;text-align: left;margin-left: 40px;"></el-checkbox> <span style="color: white;position: relative;font-size: 15px;right: 77px;top: 1px;">自动登录</span> </div> <button @click="login()">Login</button> </div>
		</div>
	</div>
</template>
<script type="text/javascript">
	import config from "@/config.json";
	export default {
		name: "login",
		data() {
			return {
				config: config,
				userId: "",
				passwold: "",
				checked: false,
				multipleSelection: []
			}
		},
		methods: {
			login() {
				let $this = this;

				if(this.userId == "" || this.passwold == "") {
					this.$message({
						showClose: true,
						message: '账号密码不能为空！',
						type: 'warning'
					});
				} else {
					this.$ajax({
						method: 'post',
						url: config.service_base_path + "admin/login",
						params: {
							id: this.userId,
							pwd: this.passwold,
							rememberMe: this.rememberMe
						},
						headers: {
							'X-Requested-With': 'XMLHttpRequest'
						},
						transformResponse: [function(res) {
							if(res.code == 10010002) {
								this.$message({
									showClose: true,
									message: '账号密码错误',
									type: 'error'
								});
							} else {
								$this.$router.replace({
									path: `${config.ui_base_path}home/usrList`
								});

							}
						}],

					})

				}

			}
			//
		},
		created() {}
	}
</script>